/***************************************************************************************************
  *Copyright(C),2010-2016,Sumscope
  *FileName	:  Rand.h
  *Author	:  scofined.qi
  *Version	:  1.0
  *Date		:  2016/08/20
  *Desc		:  //用于主要说明此程序文件完成的主要功能
  *Relation :  
  *Others	:  //其他内容说明
  *Function :  //主要函数列表，每条记录应包含函数名及功能简要说明
  *History	:  //修改历史记录列表，每条修改记录应包含修改日期、修改者及修改内容简介
***************************************************************************************************/
#pragma once

#include "BaseString.h"
#include "../core.h"
#include <string>
#include <string.h>

typedef unsigned long       DWORD;

namespace qb{
	namespace base{

#define RSF_Alphabet		0x0001			// a-z,A-Z
#define RSF_Number			0x0002			// 0-9
#define RSF_CNWord			0x0004			// 汉字
#define RSF_Keyboard		0x0008			// 键盘字符:~!@#$%^&*()_+`-=[]{};:"'|\/?<,>.
#define RSF_BASE64			0x0010			// base64编码,伪造的
#define RSF_CAPITAL			0x0020			// A-Z
#define RSF_Default			(RSF_Alphabet|RSF_Number|RSF_CNWord)

        class S_CORE_EXPORT Rand{
		public:
			static int RandInt(int mi, int mx);//[mi,mx)
			static float RandFloat(float mi, float mx);//[mi,mx)
			static double RandDouble(double mi, double mx);//[mi,mx)
			static float RandAround(float base, float percentage);
			static double RandAround(double base, double percentage);
			static BaseString RandNumString();
			static BaseString RandString(int minLength, int maxLength, DWORD flag = RSF_Default);
			static void RandString(BaseString& out,int minLength, int maxLength, DWORD flag = RSF_Default);
		};

		class NumGeneratorImpl;
        class RandNumGenerator{
			NumGeneratorImpl*	m_impl;
		public:
			RandNumGenerator();
			~RandNumGenerator();
			void SetIntPartCount(unsigned int count);
			void SetDigitPartCount(unsigned int count);
			void SetExpPartCount(unsigned int count);

			std::string Generate();
		};
	}//namespace base;
}//namespace qb;
